<?php
class Application_Model_event extends Application_Model_DomainObject{
	
        protected $_id;//
        protected $_userid;
        protected $_username;
        protected $_opType;
        protected $_opTime;
        protected $_opCaption;
        protected $_url;
        
        protected static function getDb(){
		return new Application_Model_DbTable_event(); 
	}
        
        /**
     * 
     * @param int $inid
     * @param int $memberId
     * @param date $startTime 开始时间
     * @param date $endTime 结束时间
     * @param int $status 状态
     * @param int $count
     * @param int $offset
     * @return 返回格式为 array('size'=>?,'list'=>?,'pages'=>?,'index'=>?) 
     * size为查询记录的总条数，list为返回的array型数据，pages是指有多少页，index为当前是哪一页 
     */
    public static function getByFilter($inid,$memberId,$startTime,$endTime, $status, $count, $offset){
        $where = array();
        $and = '';
        $wayid=NULL;
        if($wayid != NULL){
            $where['Id = '] = $inid;
            $and = ' and ';
        }
        
        if ($memberId != NULL){
            $where[$and.' userId = '] = $memberId;
            $and = ' and ';
        }
        
        if($startTime != NULL){
            $where[$and.' opTime >= '] = $startTime;
            $and = ' and ';
        }
        
        if($endTime != NULL){
            $where[$and.' opTime <= '] = $endTime;
            $and = ' and ';
        }
        
        return Application_Model_event::getDb()->queryPage($where, 'opTime desc ', $count, $offset);
        
    }
}